package com.itc.system.api.factory;

import com.itc.system.api.FlightOperationService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class FlightOperationFactory implements FallbackFactory<FlightOperationService> {
    private static final Logger log = LoggerFactory.getLogger(FlightOperationFactory.class);

    @Override
    public FlightOperationService create(Throwable throwable)
    {
        return new FlightOperationService()
        {
            @Override
            public void monitorDataUpdate(String source) {
                log.error("航班宽表数据更新调用失败:{}", throwable.getMessage());
            }

            @Override
            public void ptdDataUpdate(String source) {
                log.error("预测起飞数据更新调用失败:{}", throwable.getMessage());
            }

            @Override
            public void timeslotExchange(String source) {
                log.error("时隙交换航班信息同步调用失败:{}", throwable.getMessage());
            }

            @Override
            public void alarmTrigger(String source) {
                log.error("告警规则触发逻辑调用失败:{}", throwable.getMessage());
            }

            @Override
            public void oaDeptUserDataUpdate(String source) {
                log.error("OA部门用户信息同步调用失败:{}", throwable.getMessage());
            }

            @Override
            public void aocScheduleUpdate(String source) {
                log.error("AOC排班信息同步调用失败:{}", throwable.getMessage());
            }
        };
    }
}
